<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.infomanage.po.*" %>
<%@page import="com.infomanage.vo.*" %>
<%@page import="com.infomanage.enums.*"%>
<%@page import="com.infomanage.service.study.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    StudyPhysicalTestItem item = StudyPhysicalTestService.loadStudyPhysicalTest(request, response, out);
    String age = "";
    String bmi = "";
    String evaluation = "";
    int evaluationLevel= 0;
    String fatLevel = "";
    String gripK = "";
    String gripN = "";
    String height = "";
    String lungCapacity = "";
    String metabolism = "";
    String personName = "";
    int personId = 0;
    String portraitJump = "";
    String pushUps = "";
    String reactionTime = "";
    String score = "";
    String serialNumber = "";
    int sex = 1;
    String sitForward = "";
    String sitUps = "";
    String suggest = "";
    String timestamp = "";
    String weight = "";
    int starLevel = 0;
    
    if(item != null) {
    	StudyPhysicalTest bean = item.getBean();
    	Person person = item.getPerson();
    	age = bean.getAge();
    	bmi = bean.getBmi();
    	evaluation = bean.getEvaluation();
    	evaluationLevel = bean.getEvaluationLevel();
    	fatLevel = bean.getFatLevel();
    	gripK = bean.getGripK();
    	gripN = bean.getGripN();
    	height = bean.getHeight();
    	lungCapacity = bean.getLungCapacity();
    	metabolism = bean.getMetabolism();
    	personName = person.getName();
    	personId = person.getPersonId();
    	portraitJump = bean.getPortraitJump();
    	pushUps = bean.getPushUps();
    	reactionTime = bean.getReactionTime();
    	score = bean.getScore();
    	serialNumber = bean.getSerialNumber();
    	sex = bean.getSex();
    	sitForward = bean.getSitForward();
    	sitUps = bean.getSitUps();
    	suggest = bean.getSuggest();
    	timestamp = bean.getTimestamp();
    	weight = bean.getWeight();
    } 
%>
<html>
<head>
	<title>体质测试</title>
	<link href="../../css/table.css" rel="stylesheet" type="text/css">
	<link href="../../css/calendar.css" rel="stylesheet" type="text/css">
	<style type="text/css">
		.field2{
			background: #D1DDEF;
			text-align: center;
			font-weight: bold;
		}
	</style>
	<script type="text/javascript" src="../../js/calendar.js"></script>
	<script type="text/javascript" src="../../js/common.js"></script>
	<script type="text/javascript">
	 function init() {
		   if("" != "<%=itemId%>") { // 修改
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		form1.actionType.value = "add";
		 	form1.submit();
	   }

	   function validate(){
	   		if(form1.timestamp.value == ""){
	   			alert("日期不能为空！");
	   			return true;
	   		}
	   		if(form1.personName.value == -1){
	   			alert("姓名不能为空！");
	   			return true;
	   		}
	   		
	   		if(form1.evaluation.value.length > 5000){
   				alert("综合评价不能超过5000个字！");
   				return true;
	   	    }	
	   		
	   		if(form1.suggest.value.length > 5000){
   				alert("建议不能超过5000个字！");
   				return true;
	   	    }	
	   		return false;
	   }
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="physiqueTest_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>体质测试</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td height="100%">
				<!-- 数据项 -->
				<div style="height: 100%;overflow: auto;">
				<table style="table-layout: fixed;" border="0">
					<col width="16%">
					<col width="22%">
					<col width="14%">
					<col width="12%">
					<col width="28%">
					<tr>
						<td>
							编号：<input type="text" name="serialNumber" class="singleBorder" style="width:80px">
						</td>
						<td>
							姓名：<span class="treeSpan2" onclick="showTree(this, '../common/personTree.jsp');" treeSelect="true"><input 
									class="singleBorder" value="<%=personName %>" style="width: 150px;text-align:center;" readonly="readonly" treeSelect="true"><input name="personId" value="<%=personId %>" type="hidden"></span>
						</td>
						<td>
							性别：<select name="sex" style="margin-left:5px;width:50px;">
							   <%
			                   		for(SexType type: SexType.getMembers()){
			                   %>			
			                   		<option value="<%= type.value() %>"><%= type.title()%></option>
			                   <%
			                   		}
			                   %>
							</select>
						</td>
						<td align="center">
							年龄：<input type="text" class="singleBorder" name="age" style="width: 30px">岁
						</td>
						<td>
							测试日期：
							<input value="<%=timestamp %>" type="text" class="singleBorder" name="timestamp" style="width: 150px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="../../img/tip_calender.gif" style="cursor: hand;visibility: hidden;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>
					</tr>
				</table>
				<!-- 基本检测数据 -->
				<table class="dataTable2">
					<col width="15%">
					<col width="30%">
					<col width="30%">
					<col width="25%">
					<tr>
						<td class="field" rowspan="6">
							<b>基本检测数据</b>
						</td>
						<td>
							身高:<input type="text" name="height" class="singleBorder">厘米
						</td>
						<td>
							体重:<input type="text" name="weight" class="singleBorder">公斤
						</td>
						<td>
							肺活量:<input type="text" name="lungCapacity" class="singleBorder">毫升
						</td>
					</tr>
					<tr>
						<td>
							握力:<input type="text" name="gripK" class="singleBorder">公斤力
							<input type="text" name="gripN" class="singleBorder" style="width:50px">牛顿
						</td>
						<td>
							俯卧撑（男）:<input type="text" name="pushUps" class="singleBorder">个
						</td>
						<td colspan="2">
							仰卧起坐:<input type="text" name="sitUps" class="singleBorder">个
						</td>
					</tr>
					<tr>
						<td>
							坐位体前屈:<input type="text" name="sitForward" class="singleBorder">厘米
						</td>
						<td>
							反应时:<input type="text" name="reactionTime" class="singleBorder">秒
						</td>
						<td>
							纵跳:<input type="text" name="portraitJump" class="singleBorder">厘米
						</td>
					</tr>
					<tr>
						<td>
							体质指数BMI:<input type="text" name="bmi" class="singleBorder">
						</td>
						<td>
							肥胖度:<input type="text" name="fatLevel" class="singleBorder">%
						</td>
						<td>
							基础代谢:<input type="text" name="metabolism" class="singleBorder">千卡
						</td>
					</tr>
				</table>
				
				<!-- 各单项指标评价 -->
				<table class="dataTable2">
					<col width="15%">
					<col width="20%">
					<col width="10%">
					<col width="10%">
					<col width="10%">
					<col width="10%">
					<col width="10%">
					<col width="15%">
					<tr>
						<td rowspan="11" class="field">
							<b>各单项指标评价</b>
						</td>
						<td class="field2">
							指标
						</td>
						<td class="field2">
							优秀
						</td>
						<td class="field2">
							良好
						</td>
						<td class="field2">
							中等
						</td>
						<td class="field2">
							中下
						</td>
						<td class="field2">
							差
						</td>
						<td class="field2">
							星级
						</td>
					</tr>
					<%
						String[] zbs = new  String[]{"身高标准体重", "肺活量", "握力", "坐位体前屈",
											"台阶试验指数", "纵跳", "俯卧撑（男）", "仰卧起坐", "闭眼单足站立", "反应时"};
						int rowCount = zbs.length;	
						for(int i = 0; i < rowCount; i++) {
					%>
					<tr>
						<td>
							<%=zbs[i] %>
						</td>
						<%
							int colCount = 5;
							for(int j = 0; j < colCount; j++) {
						%>
						<td align="center">
							<input type="radio" name="score_<%=i %>" value="<%=i + "_" + j %>">
						</td>
						<%
							}
						%>		
						<td align="center">
							<select name="star">
								<option value=0>☆☆☆☆☆</option>
								<option value=1>★☆☆☆☆</option>
								<option value=2>★★☆☆☆</option>
								<option value=3>★★★☆☆</option>
								<option value=4>★★★★☆</option>
								<option value=5>★★★★★</option>
							</select>
						</td>				
					</tr>
					<%
						}
					%>
				</table>
				<!-- 各单项指标评价 -->
				<table class="dataTable2">
					<col width="15%">
					<col width="85%">
					<tr>
						<td class="field">
							<b>综合评价</b>
						</td>
						<td style="height: 150;padding-left:0px">
							<table cellpadding="0" cellspacing="0" style="table-layout: fixed;height: 100%;width: 100%;border: none;">
								<col width="30">
								<col width="30">
								<col width="40">
								<tr style="20px">
									<td height="100%" style="border: none;">
										总体平均得分:&nbsp;<input type="text" name="score" class="singleBorder">	
									</td>
									<td height="100%" style="border: none;">
										总体评价:&nbsp;<select name="evaluationLevel">
										   <%
						                   		for(EvaluationLevelType type: EvaluationLevelType.getMembers()){
						                   %>			
						                   		<option value="<%= type.value() %>"><%= type.title()%></option>
						                   <%
						                   		}
						                   %>
										</select>
									</td>
									<td height="100%" style="border: none;">
										星级:&nbsp;
										<select name="starLevel">
										   <%
						                   		for(StarLevelType type: StarLevelType.getMembers()){
						                   %>			
						                   		<option value="<%= type.value() %>"><%= type.title()%></option>
						                   <%
						                   		}
						                   %>
										</select>
									</td>
								</tr>
								<tr>
									<td colspan="3" height="120px" style="border: none;">
										<textarea name="evaluation" style="width: 100%;height: 100%;"></textarea>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				<table class="dataTable2">
					<col width="15%">
					<col width="85%">
					<tr>
						<td class="field">
							<b>运动及营养建议</b>
						</td>
						<td height="180px">
							<textarea name="suggest" style="width: 100%;height: 100%"></textarea>
						</td>
					</tr>
				</table>
				</div>
			</td>
		</tr>
		<tr>
			<td class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td>
				&nbsp;
			</td>
		</tr>
	</table>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>